using UnityEngine;

public class DeactivableFallingObject : FallingObjectBehaviour
{
	private Rigidbody _rigid;

	protected override void Awake()
	{
		base.Awake();
		_rigid = GetComponent<Rigidbody>();
	}

	private void OnEnable()
	{
		_holeId = -1;
		_isDestroyed = false;
		_rigid.velocity = Vector3.zero;
		_rigid.angularVelocity = Vector3.zero;
	}

	public override void DisableObject()
	{
		if (!_isDestroyed)
		{
			_isDestroyed = true;
			_gameManager.ProcessCapture(this, _holeId);
			Invoke("DestroyObject", 3f);
		}
	}

	public override void ForceDisableObject()
	{
		if (!_isDestroyed)
		{
			_isDestroyed = true;
			_gameManager.ProcessCapture(this, _holeId);
			DestroyObject();
		}
	}

	private void DestroyObject()
	{
		base.gameObject.SetActive(value: false);
	}
}
